<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        var arr = [1,2,3,4,5];
        Array.prototype.myMap = function(f){  //形参，回调函数
            var newArr = [];
            var arr = this.valueOf();  //valueOf()返回对象的原始值，this为调用函数的对象的引用
            for(var i = 0,len = arr.length;i<len;i++){
                newArr.push(f(arr[i]));
            }
            return newArr;
        }
        var b = arr.myMap(function(v){return v+100;});
        console.log(b);
    </script>
</body>
</html>